using System;

using System.Data;
using System.Data.SqlClient;
using System.Configuration;
 
namespace DAL
{
    public class clsConnectionDB
    {
        private SqlConnection prSqlConn;
        private string prS_svName;
        private string prS_dbName;
        private string prS_usName;
        private string prS_usPassword;

        public clsConnectionDB(string svName, string dbName, string usName, string pass)
        {
            this.prS_svName = svName;
            this.prS_dbName = dbName;
            this.prS_usName = usName;
            this.prS_usPassword = pass;
            this.prSqlConn = null;
        }
       
        public SqlConnection PSql_openSqlConn()
        {
            this.prSqlConn = new SqlConnection();
            try
            {
                if (this.prSqlConn.State == ConnectionState.Closed)
                {
                    this.prSqlConn.Open();
                }
            }
            catch
            {
                this.prSqlConn = null;
            }
            return this.prSqlConn;
        }
       
        public void PSql_closeSqlConn()
        {
            if (this.prSqlConn != null)
            {
                if (this.prSqlConn.State == ConnectionState.Open)
                {
                    this.prSqlConn.Close();
                    this.prSqlConn.Dispose();
                }
            }
        }


    }
}
